package fhp.hlhj.giantfold.customView

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.widget.PopupWindow
import android.widget.RelativeLayout
import fhp.hlhj.giantfold.R
import kotlinx.android.synthetic.main.order_pop.view.*

/**
 * author: FHP
 * data: on 2018\1\31 0031 10:30
 * E-Mail: 103945089@qq.com
 */
class OrderPop(private val context: Context,private val listener:onPopSelect):PopupWindow() {
    private lateinit var rootView:View
    init {
        initPop()
        setPop()
    }

    private fun setPop() {
        this.width= RelativeLayout.LayoutParams.MATCH_PARENT
        this.height= RelativeLayout.LayoutParams.WRAP_CONTENT
    }

    private fun initPop() {
        rootView=LayoutInflater.from(context).inflate(R.layout.order_pop,null)
        contentView=rootView

        rootView.btJZOder.setOnClickListener {
            listener.jzOrder()
            dismiss()
        }
        rootView.btJDOrder.setOnClickListener {
            listener.jdOrder()
            dismiss()
        }
        rootView.btAliOrder.setOnClickListener {
            listener.aliOrder()
            dismiss()
        }
        rootView.btXPOrder.setOnClickListener {
            listener.xpOrder()
            dismiss()
        }



    }

    interface onPopSelect{
        fun jzOrder()
        fun aliOrder()
        fun jdOrder()
        fun xpOrder()
    }
}